package com.hemaapp.yjnh.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.hemaapp.yjnh.BaseActivity;
import com.hemaapp.yjnh.R;

public class BlogFlagActivity extends BaseActivity implements OnClickListener{

	private TextView titleText;
	private ImageButton titleLeft;
	private Button titleRight;
	
	private TextView tvNongji;
	private TextView tvYangsheng;
	private TextView tvQiuzhu;
	private TextView tvButie;
	private TextView tvYihuo;
	private TextView tvOther;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_blog_flag);
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void findView() {
		titleText = (TextView) findViewById(R.id.title_text);
		titleLeft = (ImageButton) findViewById(R.id.title_left_btn);
		titleRight = (Button) findViewById(R.id.title_right_btn);

		tvNongji = (TextView)findViewById( R.id.tv_nongji );
		tvYangsheng = (TextView)findViewById( R.id.tv_yangsheng );
		tvQiuzhu = (TextView)findViewById( R.id.tv_qiuzhu );
		tvButie = (TextView)findViewById( R.id.tv_butie );
		tvYihuo = (TextView)findViewById( R.id.tv_yihuo );
		tvOther = (TextView)findViewById( R.id.tv_other );
	}

	@Override
	protected void setListener() {
		titleLeft.setOnClickListener(this);
		titleText.setText("发布标签");
		titleRight.setVisibility(View.GONE);

		tvNongji.setOnClickListener(this);
		tvYangsheng.setOnClickListener(this);
		tvQiuzhu.setOnClickListener(this);
		tvButie.setOnClickListener(this);
		tvYihuo.setOnClickListener(this);
		tvOther.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		switch (v.getId()) {
		case R.id.tv_nongji:
			intent.putExtra("key", "农技");
			break;
		case R.id.tv_yangsheng:
			intent.putExtra("key", "养生");
			break;
		case R.id.tv_qiuzhu:
			intent.putExtra("key", "求助");
			break;
		case R.id.tv_butie:
			intent.putExtra("key", "补贴");
			break;
		case R.id.tv_other:
			intent.putExtra("key", "其它");
			break;
		case R.id.tv_yihuo:
			intent.putExtra("key", "易货");
			break;
		default:
			break;
		}
		setResult(RESULT_OK, intent);
		finish();
	}
}
